/*zpzkGPKnvYNiqDhr3wAplWChqGL2R8zSswuP6eDiV80A4oSrGfAxnWlTmMk7LtTo*/
/*
 * @Descripttion:
 * @version:
 * @Author: Chendch
 * @Date: 2018-10-10 17:36:07
 * @LastEditors: Chendch
 * @LastEditTime: 2021-04-09 16:14:22
 */
/**
 * 获取当前时间时分秒
 * sign:'-,:'或':,:'
 * **/
const getYMDHMS = (date=new Date(),sign='') => {
    // const date = new Date();
    const year = date.getFullYear();
    const month = date.getMonth() + 1;
    const dateT = date.getDate();
    const hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    const minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    const second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    const day = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")[date.getDay()];
    let currentTime = null;
    if(sign.includes(',')) {
        let signArr = sign.split(',');
        currentTime = `${year}${signArr[0]}${month}${signArr[0]}${dateT} ${hour}${signArr[1]}${minutes}${signArr[1]}${second}`
    }else {
        currentTime = `${year}${month}${dateT} ${hour}${minutes}${second}`
    }
    return currentTime;
}
/**
 * 获取当前日期n天后的日期
 * **/
function addDate(num) {
    let nowDateObj = new Date();
    let nowTimeStem = nowDateObj.getTime();
    let endTimeStem = nowTimeStem + 24*60*60*1000*num;
    let endDateObj = new Date(endTimeStem);
    let month = endDateObj.getMonth() + 1;
    month = month>10?month:'0'+month;
    let day = endDateObj.getDate();
    day = day>10?day:'0'+day;
    let endDateStr = endDateObj.getFullYear() +'-'+month+'-'+day;
    return endDateStr;
}

export {
    getYMDHMS,
    addDate
}
/*zpzkGPKnvYNiqDhr3wAplWChqGL2R8zSswuP6eDiV80A4oSrGfAxnWlTmMk7LtTo*/
